

import java.util.Arrays;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
import org.junit.Test;


public class text{

	@Test
	public void test1() throws Exception {
		Text value=new Text("03013,19960709,72,60,  66 ,  66, 62, 62,  0,  1,RA FG ,0.0,-,-, 0.11,26.28,30.02, 11.5,12,12.0, 24,11, 20,11");
		
		new MapDriver<LongWritable,Text,Text,IntWritable>()
		.withMapper(new MaxTempMapper())
		.withInputValue(value)
		.withOutput(new Text("19960709"), new IntWritable(72))
		.runTest();
//		new MapDriver<LongWritable,Text,Text,IntWritable>(new MaxTempMapper())
	}
	@Test
	public void test2()throws Exception{
		new ReduceDriver<Text,IntWritable,Text,IntWritable>()
		.withReducer(new MaxTempReducer()).withInputKey(new Text("19960709")).withInputValues(Arrays.asList(new IntWritable(37),new IntWritable(57),new IntWritable(78)))
		.withOutput(new Text("19960709"), new IntWritable(7))
		.runTest();;
	}
}
